package com.vhly.ddxdecompiler.dexreader.file.mixeditem;

import com.vhly.ddxdecompiler.dexreader.file.DexFile;
import com.vhly.ddxdecompiler.dexreader.file.TypeIdsSection;
import com.vhly.ddxdecompiler.dexreader.io.DexInputStream;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ByteArrayInputStream;

public final class AnnotationItem extends OffsettedItem {

    private DexFile dex;

    private Annotation anno;

    public AnnotationItem(DexFile dexFile) {
        super(4, 0);
        dex = dexFile;
    }

    /**
     * 读取数据
     *
     * @param din 输入流
     * @throws java.io.IOException 异常
     */
    public void read(DexInputStream din) throws IOException {
        int visiblity = din.readByte();
        ValueDecoder decoder = new ValueDecoder();
        anno = decoder.readAnnotation(din);
        anno.reloc(dex);
    }

    /**
     * 输出数据
     *
     * @param dout 输出流
     * @throws java.io.IOException 异常
     */
    public void write(DataOutputStream dout) throws IOException {
    }

    public Annotation getAnno() {
        return anno;
    }
}